<template>
<div style="margin: 5px">
  <el-card style="padding:10px;background:#EBEEF5">
    <div style="margin: 10px 0;width: 100%">
      <el-button :icon="Upload"  type="primary" @click="exportScore">导出</el-button>
    </div>
    <el-table :data="tableData"  :row-style="tableRowStyle" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}"
              border resizable="true" style="width: 100%" >
<!--      <el-table-column prop="id" label="ID" sortable/>-->
      <el-table-column prop="gameName" label="比赛名称"/>
      <el-table-column prop="nickName" label="学生/团队名称"/>
      <el-table-column prop="title" label="作品名称"/>
      <el-table-column prop="allScore" label="总分" sortable/>

    </el-table>
  </el-card>
</div>
</template>

<script>
import { Edit,Remove,CirclePlus,Upload,Download,Search,Refresh,View,CircleClose } from '@element-plus/icons-vue';
import request from "@/utils/request";


export default {
  name: "summaryGrade",
  setup(){
    return{

      Upload,

    }
  },
  components: {Edit},
  data(){
    return{

      currentPage: 1,
      total: 0,
      pageSize: 10,
      tableData: [],
      gameId:0

    }
  },
  created() {
    this.load()
  },
  methods:{
    load() {
      this.gameId = sessionStorage.getItem("gameId")
    request.get("/score/allScore/"+this.gameId).then(res =>{
      console.log(res)
      this.tableData=res.data
    })

    },
    tableRowStyle({ row, rowIndex }) {
      return { background:'#F2F6FC', color: '#0052d9', 'font-weight': 600 }
    },
    handleSizeChange(pageSize) {
      this.pageSize=pageSize;
      this.load();
    },
    handleCurrentChange(pageNum) {
      this.currentPage=pageNum;
      this.load();
    },
    exportScore() {
      location.href = "http://localhost:9090/score/export/"+this.gameId;
    },
  }
}
</script>

<style scoped>

</style>